package com.xingzuo.library_login.ui.fragment;

import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.callback.NavCallback;
import com.alibaba.android.arouter.facade.callback.NavigationCallback;
import com.alibaba.android.arouter.launcher.ARouter;
import com.xingzuo.base.app.AppActivityKey;
import com.xingzuo.base.ui.mvp.base.ui.BaseMvpFragment;
import com.xingzuo.common.event.LoginEventBean;
import com.xingzuo.library_login.R;
import com.xingzuo.library_login.R2;
import com.xingzuo.library_login.contract.PhoneLoginContract;
import com.xingzuo.library_login.presenter.PhoneLoginPresenter;

import org.greenrobot.eventbus.EventBus;

import butterknife.BindView;
import butterknife.OnClick;

public class LoginPhoneFragment extends BaseMvpFragment<PhoneLoginPresenter> implements PhoneLoginContract.View {
    @BindView(R2.id.iv_logo)
    ImageView ivLogo;
    @BindView(R2.id.ll_phone)
    LinearLayout llPhone;
    @BindView(R2.id.ll_password)
    LinearLayout llPassword;
    @BindView(R2.id.view1)
    View view1;
    @BindView(R2.id.btn_wechat_login)
    Button btnWechatLogin;
    @BindView(R2.id.cb_agree)
    CheckBox cbAgree;
    @BindView(R2.id.tv_user_service)
    TextView tvUserService;
    @BindView(R2.id.tv_yinsi)
    TextView tvYinsi;
    @BindView(R2.id.iv_wechat)
    ImageView ivWechat;

    @Override
    public PhoneLoginPresenter getPresenter() {
        return new PhoneLoginPresenter();
    }

    @Override
    public int getViewId() {
        return R.layout.fragment_phone_login;
    }

    @Override
    public void initView() {

    }

    @Override
    public void initLinsenterner() {

    }

    @Override
    public void getData() {

    }

    @OnClick({R2.id.btn_wechat_login, R2.id.iv_wechat})
    public void onViewClicked(View view) {
        int id = view.getId();
        if (id == R.id.btn_wechat_login) {
            ARouter.getInstance().build(AppActivityKey.HOMEACTIVITY).navigation(mContext, new NavigationCallback() {
                @Override
                public void onFound(Postcard postcard) {
                    Log.e("ARouter",postcard.toString());
                }

                @Override
                public void onLost(Postcard postcard) {
                    Log.e("ARouter",postcard.toString());
                }

                @Override
                public void onArrival(Postcard postcard) {
                    Log.e("ARouter",postcard.toString());
                }

                @Override
                public void onInterrupt(Postcard postcard) {
                    Log.e("ARouter",postcard.toString());
                }
            });
           // startIntent(AppActivityKey.HOMEACTIVITY);
        } else if (id == R.id.iv_wechat) {
            EventBus.getDefault().post(new LoginEventBean(1));
        }
    }
}